#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main(void)
{
        umask(0);
        mkfifo("./fifo.pipe", S_IRUSR|S_IWUSR);
        int fd;
        char buf[1024];
        pid_t pid=fork();
        if (0==pid)
        {
                fd=open("fifo.pipe", O_WRONLY);
                write(fd, "jjjjjjjjjj", sizeof("jjjjjjjjjj"));
                close(fd);
        }
        else if(0!=pid)
        {
                fd=open("fifo.pipe", O_RDONLY);
                while(1)
                {
                read(fd,buf,1024);
                printf("%s",buf);
                }
                close(fd);
        }
        return 0;
}
